package com.soilflow.info.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.soilflow.common.domain.LandContract;
import com.soilflow.common.domain.LandFund;
import com.soilflow.common.domain.LandInfo;
import com.soilflow.info.mapper.LandFundMapper;
import com.soilflow.info.service.LandFundService;
import com.soilflow.info.service.LandInfoService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

@Service
public class LandFundServiceImpl extends ServiceImpl<LandFundMapper, LandFund> implements LandFundService {
    @Autowired
    private LandInfoService landInfoService;

    @Override
    public void add(LandContract landContract) {
        LandFund landFund = new LandFund();
        BeanUtils.copyProperties(landContract,landFund);
        LandInfo info = landInfoService.getById(landContract.getInfoId());
        landFund.setInfoName(info.getLandName());
        this.save(landFund);
    }

    @Override
    public List<LandFund> selectLandFund(LandFund landFund) {
        List<LandFund> list = this.baseMapper.selectLandFund(landFund);
        return list;
    }
}
